package com.itheima.j2cache.model;

import com.alibaba.fastjson.JSONObject;
import lombok.Data;

import java.lang.annotation.Annotation;

/**
 * Cache相关信息包装
 * <p>
 * AnnotationInfo<T extends Annotation> 接收的范围类型为  Annotation接口的子类, 即所有的注解
 *
 * @author llhuang10
 * @date 2021/10/7 21:54
 */
@Data
public class AnnotationInfo<T extends Annotation> {

    private T annotation;
    private String region;
    private String key;


    @Override
    public String toString() {
        if (annotation == null) {
            return null;
        }
        return JSONObject.toJSONString(this);
    }
}
